package org.pay.gate.model;

public class PayGateReqModel {

    /**
     * {
     * "type": "RayGate",
     * "action": "Pay",
     * "shopID": "1444",
     * "data": {
     * "BuyerID": "224802381951832089",
     * "TxType": "22",
     * "BillNumber": "144420221101164528",
     * "Amount": 100,
     * "LocalDate": "20221101",
     * "LocalTime": "164528",
     * "Detail": "測試商品 x1,測試商品 x2,測試商品 x3"
     * }
     * }
     */

    /**
     * {
     *  "type": "RayGate",
     *  "action": "Refund",
     *  "shopID": "1444",
     *  "data": {
     *  "TxType": "23",
     *  "OrderNumber": "600000031667292367",
     *  "BillNumber": "144420221101164528",
     *  "LocalDate": "20221101",
     *  "LocalTime": "164605"
     *  }
     * }
     */

    /**
     * {
     * "type": "RayGate",
     * "action": "Check",
     * "shopID": "1444",
     * "data": {
     * "TxType": "24",
     * "BillNumber": "144420221101164528"
     * }
     * }
     */
    //固定輸入 RayGate
    private String type = "RayGate";

    // Pay Refund Check
    private String action;

    private String shopID;

    private PayGateReqDataModel data;

    public void buildPayAction() {
        this.action = "Pay";
    }

    public void buildRefundAction() {
        this.action = "Refund";
    }

    public void buildCheckAction() {
        this.action = "Check";
    }

    public void buildPayReqData(String shopID,String buyerId, double amount, String detail) {
        setShopID(shopID);
        this.data = PayGateReqDataModel.buildPayDataModel(shopID, buyerId, amount, detail);
    }

    public void buildRefundReqData(String orderNumber, String billNumber, String localDate, String localTime) {
        this.data = PayGateReqDataModel.buildRefundDataModel(orderNumber, billNumber, localDate, localTime);
    }

    //

    public PayGateReqModel() {
    }

    public PayGateReqModel(String action, String shopID, PayGateReqDataModel data) {
        this.action = action;
        this.shopID = shopID;
        this.data = data;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getAction() {
        return action;
    }

    public void setAction(String action) {
        this.action = action;
    }

    public String getShopID() {
        return shopID;
    }

    public void setShopID(String shopID) {
        this.shopID = shopID;
    }

    public PayGateReqDataModel getData() {
        return data;
    }

    public void setData(PayGateReqDataModel data) {
        this.data = data;
    }

    @Override
    public String toString() {
        return "PayGateReqModel{" +
                "type='" + type + '\'' +
                ", action='" + action + '\'' +
                ", shopID='" + shopID + '\'' +
                ", data=" + data.toString() +
                '}';
    }
}
